<?php

namespace app\common\model\repertory;

use app\common\model\BaseModel;
use app\common\model\repertory\Units;
use app\common\model\repertory\Proclass;

/**
 * 产品
 */
class Product extends BaseModel
{
    protected $name = 'repertory_product';
    protected $pk = 'id';

    public static function detail($id)
    {
        return self::find($id);
    }

    public function units()
    {
        return $this->belongsTo(Units::class, 'unit_id', 'id')->bind(['units_name' => 'title']);
    }

    public function proclass()
    {
        return $this->belongsTo(Proclass::class, 'class_id', 'id')->bind(['class_name' => 'title']);
    }
}
